package cn.wps.moffice.common; import android.content.Context; import android.content.res.Resources; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import cn.wps.moffice.common.beans.AlphaRelativeLayout; import cn.wps.moffice.common.fileupload.RoundImageView; import cn.wps.moffice.common.fileupload.RoundProgressBar; import cn.wps.moffice.define.VersionManager; import cn.wps.moffice_eng.R; import defpackage.eip; import java.io.File; public class SaveIconGroup extends AlphaRelativeLayout { private boolean cEC; private ImageView cJj; private RoundProgressBar cJk; public RoundProgressBar cJl; private RoundImageView cJm; public ddh cJn = ddh.NORMAL; private boolean cJo = true; private int cJp = -1; private boolean cJq = VersionManager.aYS(); private boolean cJr; private boolean cJs; private boolean cJt; private a cJu = null; public boolean cJv = false; private eip.a crP = eip.a.appID_presentation; public interface a { String awK(); } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public SaveIconGroup(Context context, AttributeSet attributeSet) { super(context, attributeSet); boolean z = true; if (attributeSet != null) { setEnabled(attributeSet.getAttributeBooleanValue("http://schemas.android.com/apk/res/android", "enabled", true)); this.cEC = attributeSet.getAttributeIntValue(null, "PhoneScreen", 0) <= 0 ? false : z; } initView(context); } public SaveIconGroup(Context context, boolean z, boolean z2) { super(context, null); setEnabled(z); this.cEC = z2; initView(context); } private void awH() { int i = (3 >> 2) << 1; int i2 = (!this.cEC || this.cJo || this.crP.equals(eip.a.appID_presentation)) ? R.color.color_white : R.color.phone_public_default_icon_color; if (this.cJp != i2) { this.cJj.setColorFilter(getResources().getColor(i2)); this.cJp = i2; } switch (this.cJn) { case NORMAL: setViewVisible(this.cJj); setViewGone(this.cJl, this.cJk, this.cJm); break; case UPLOADING: if (!this.cJv && !this.cJq) { if (!this.cJo || this.crP == eip.a.appID_pdf || !this.cEC) { setViewVisible(this.cJj); } else { setViewGone(this.cJj); } setViewGone(this.cJl, this.cJk, this.cJm); break; } else { setViewVisible(this, this.cJl); this.cJl.postInvalidate(); setViewGone(this.cJj, this.cJk, this.cJm); break; } case UPLOAD_ERROR: this.cJl.setProgress(this.cJl.cNd); setViewVisible(this.cJl, this.cJm); setViewGone(this.cJj, this.cJk); break; case DERTY_UPLOADING: if (!this.cJv && !this.cJq) { setViewVisible(this.cJj); setViewGone(this.cJl, this.cJk, this.cJm); break; } else { setViewVisible(this, this.cJj, this.cJk); setViewGone(this.cJl, this.cJm); break; } break; case DERTY_ERROR: setViewVisible(this.cJj, this.cJm); setViewGone(this.cJl, this.cJk); break; } } private void awI() { int i; int i2; int i3; int i4; if (!this.cEC || this.cJo || this.crP == eip.a.appID_presentation) { i = R.drawable.phone_public_upload_progress_read_icon; i2 = R.drawable.phone_public_upload_progress_read_icon_mini; i4 = getResources().getColor(R.color.color_white); i3 = -2130706433; } else { i = R.drawable.phone_public_upload_progress_read_icon_gray; i2 = 0; i4 = -8355712; i3 = -2133074981; } int color = getResources().getColor((!this.cEC || this.crP != eip.a.appID_presentation) ? (!this.cEC || this.cJo) ? cxg.c(this.crP) : R.color.phone_public_panel_title_bg_color : R.color.ppt_titbebar_toolbar_bg); this.cJl.setImage(i); this.cJl.setForegroundColor(i4); this.cJl.setBackgroundColor(i3); this.cJk.setImage(i2); this.cJk.setForegroundColor(i4); this.cJk.setBackgroundColor(i3); this.cJk.setThemeColor(color); this.cJm.setThemeColor(color); } private void initView(Context context) { inflate(context, this.cEC ? R.layout.phone_public_saveicon_group_layout : R.layout.pad_public_saveicon_group_layout, this); this.cJj = (ImageView) findViewById(R.id.image_save); this.cJk = (RoundProgressBar) findViewById(R.id.image_save_dirty_uploading); this.cJl = (RoundProgressBar) findViewById(R.id.image_save_uploading); this.cJm = (RoundImageView) findViewById(R.id.image_save_error_icon); this.cJm.setImage(R.drawable.public_titlebar_upload_error); awH(); awI(); } private static void setViewGone(View... viewArr) { for (View view : viewArr) { view.setVisibility(8); } } private static void setViewVisible(View... viewArr) { for (View view : viewArr) { view.setVisibility(0); } } public final void a(eip.a aVar) { setTheme(aVar, true); int dimensionPixelSize = getResources().getDimensionPixelSize(R.dimen.public_tiny_save_icon_width_ver); int dimensionPixelSize2 = getResources().getDimensionPixelSize(R.dimen.public_tiny_save_uploadingicon_width_ver); int dimensionPixelSize3 = getResources().getDimensionPixelSize(R.dimen.public_tiny_save_icon_padding_ver); this.cJj.getLayoutParams().width = dimensionPixelSize; this.cJj.getLayoutParams().height = dimensionPixelSize; this.cJj.setPadding(dimensionPixelSize3, dimensionPixelSize3, dimensionPixelSize3, dimensionPixelSize3); this.cJl.getLayoutParams().height = dimensionPixelSize2; this.cJl.getLayoutParams().width = dimensionPixelSize2; int dimensionPixelOffset = getResources().getDimensionPixelOffset(R.dimen.public_tiny_upload_file_progress_img_width_ver); int dimensionPixelOffset2 = getResources().getDimensionPixelOffset(R.dimen.public_tiny_upload_file_progress_img_height_ver); this.cJl.setImageWidth(dimensionPixelOffset); this.cJl.setImageHeight(dimensionPixelOffset2); Resources resources = getResources(); int dimensionPixelSize4 = resources.getDimensionPixelSize(R.dimen.public_tiny_progress_size_pad); this.cJk.getLayoutParams().height = dimensionPixelSize4; this.cJk.getLayoutParams().width = dimensionPixelSize4; this.cJm.getLayoutParams().height = dimensionPixelSize4; this.cJm.getLayoutParams().width = dimensionPixelSize4; int dimensionPixelSize5 = resources.getDimensionPixelSize(R.dimen.public_tiny_progress_padding_pad); this.cJk.setPadding(dimensionPixelSize5, dimensionPixelSize5, dimensionPixelSize5, dimensionPixelSize5); this.cJm.setPadding(dimensionPixelSize5, dimensionPixelSize5, dimensionPixelSize5, dimensionPixelSize5); this.cJk.setRoundWidth(resources.getDimensionPixelSize(R.dimen.public_tiny_progress_round_width_pad)); int dimensionPixelSize6 = resources.getDimensionPixelSize(R.dimen.public_tiny_progress_img_width_pad); int dimensionPixelSize7 = resources.getDimensionPixelSize(R.dimen.public_tiny_progress_img_height_pad); this.cJk.setImageWidth(dimensionPixelSize6); this.cJk.setImageHeight(dimensionPixelSize7); int dimensionPixelSize8 = resources.getDimensionPixelSize(R.dimen.public_tiny_progress_margin_pad); ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.cJk.getLayoutParams(); marginLayoutParams.bottomMargin = dimensionPixelSize8; marginLayoutParams.rightMargin = dimensionPixelSize8; ViewGroup.MarginLayoutParams marginLayoutParams2 = (ViewGroup.MarginLayoutParams) this.cJm.getLayoutParams(); marginLayoutParams2.bottomMargin = dimensionPixelSize8; marginLayoutParams2.rightMargin = dimensionPixelSize8; awI(); } public final boolean awJ() { return this.cJn == ddh.UPLOADING || this.cJn == ddh.DERTY_UPLOADING; } public final boolean b(boolean z, boolean z2, boolean z3) { boolean z4; this.cJr = z; this.cJs = z2; this.cJt = z3; boolean z5 = z; if (z2) { z5 |= true; } if (z3) { z5 |= true; } ddh ddh = this.cJn; Context context = getContext(); String awK = this.cJu == null ? null : this.cJu.awK(); boolean z6 = !lwv.isEmpty(awK) && 1 == fnw.bAB() && !lwd.isWifiConnected(context) && lwd.hv(context) && new File(awK).length() > ebg.eyH; if (this.cJv != z6) { this.cJv = z6; z4 = true; } else { z4 = false; } switch (z5) { case false: setEnabled(false); if (this.cJn != ddh.NORMAL) { this.cJn = ddh.NORMAL; awH(); break; } break; case true: setEnabled(z6 || this.cJq); if (this.cJn != ddh.UPLOADING) { this.cJn = ddh.UPLOADING; awH(); break; } break; case true: setEnabled(true); if (this.cJn != ddh.NORMAL) { this.cJn = ddh.NORMAL; awH(); break; } break; case true: setEnabled(true); if (this.cJn != ddh.DERTY_UPLOADING) { this.cJn = ddh.DERTY_UPLOADING; awH(); break; } break; case true: setEnabled(true); if (this.cJn != ddh.UPLOAD_ERROR) { this.cJn = ddh.UPLOAD_ERROR; awH(); break; } break; case true: setEnabled(true); if (this.cJn != ddh.UPLOADING) { this.cJn = ddh.UPLOADING; awH(); break; } break; case true: setEnabled(true); if (this.cJn != ddh.DERTY_ERROR) { this.cJn = ddh.DERTY_ERROR; awH(); break; } break; case true: setEnabled(true); if (this.cJn != ddh.DERTY_UPLOADING) { this.cJn = ddh.DERTY_UPLOADING; awH(); break; } break; } if (z4) { awH(); } return this.cJn != ddh; } public final boolean fK(boolean z) { boolean z2 = false; boolean z3 = this.cJn == ddh.UPLOADING || this.cJn == ddh.DERTY_UPLOADING; if (this.cJn == ddh.UPLOAD_ERROR || this.cJn == ddh.DERTY_ERROR) { z2 = true; } return b(z3, z, z2); } public void setProgress(int i) { boolean z = false; if (ddh.UPLOAD_ERROR == this.cJn && i == 0) { z = true; } this.cJl.setProgress(z ? this.cJl.cNd : i); RoundProgressBar roundProgressBar = this.cJk; if (z) { i = this.cJk.cNd; } roundProgressBar.setProgress(i); } public void setSaveFilepathInterface(a aVar) { this.cJu = aVar; } public void setSaveState(ddh ddh) { if (this.cJn != ddh) { this.cJn = ddh; awH(); } } public void setTheme(eip.a aVar, boolean z) { int i = this.cEC ? R.drawable.v10_public_titlebar_save : R.drawable.public_titlebar_save; this.crP = aVar; this.cJo = z; this.cJj.setImageResource(i); int dimensionPixelOffset = getResources().getDimensionPixelOffset(R.dimen.public_upload_file_progress_img_width); int dimensionPixelOffset2 = getResources().getDimensionPixelOffset(R.dimen.public_upload_file_progress_img_height); this.cJl.setImageWidth(dimensionPixelOffset); this.cJl.setImageHeight(dimensionPixelOffset2); this.cJk.setPicOffsetY(-1); awI(); awH(); } }